package io.hxci.modules.tea.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import io.hxci.common.annotation.DataFilter;
import io.hxci.common.utils.Constant;
import io.hxci.common.utils.PageUtils;
import io.hxci.common.utils.Query;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.hxci.modules.tea.domain.TeaPatent;
import io.hxci.modules.tea.dao.TeaPatentMapper;
import io.hxci.modules.tea.service.TeaPatentService;
@Service
public class TeaPatentServiceImpl extends ServiceImpl<TeaPatentMapper, TeaPatent> implements TeaPatentService{

    @Override
    @DataFilter(subDept = true, user = true, tableAlias = "u")
    public PageUtils queryPage(Map<String, Object> params) {
        String sql_filter = (String)params.get(Constant.SQL_FILTER);
        String username = (String)params.get("username");
        String deptId = (String)params.get("deptId");
        IPage<TeaPatent> page = new Query<TeaPatent>().getPage(params);
        page.setRecords(this.baseMapper.queryPage(page,sql_filter,username,deptId));
        return new PageUtils(page);
    }

    @Override
    @DataFilter(subDept = true, user = false, tableAlias = "u")
    public List<TeaPatent> exportExcel(Map<String, Object> params) {
        String sql_filter = (String)params.get(Constant.SQL_FILTER);
        String deptId = (String)params.get("deptId");
        return baseMapper.exportExcel(sql_filter,deptId);
    }
}
